<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <!--{include file='comm/header.tpl'}-->
    <title>商品库存列表</title>
</head>
<body>

<!--{include file='comm/naviBanner.tpl'}-->

<div class="container">

    <!--{include file='comm/menu.tpl'}-->


        <div class="comm_crub">
            <span class="now_crub">商品库存列表</span>
        </div>

        <div class="comm_content">

            <div class="search-box">
                <div style="position:relative">
                    <form id="search_form" onsubmit="return false;" class="form-inline">
                        <table>
                            <tbody>
                            <tr>
                                <td>
                                    <span>
                                        筛选条件：<select class="form-control input-sm" id="choice" name="choice">
                                            <option value="1">商品名称</option>
                                            <option value="2">商品编号</option>
                                            <option value="3">商品主编码</option>
                                        </select>
                                        <input type="text" name="choiceValue" id="choiceValue" value="" class="form-control input-sm" style="width:300px;">
                                    </span>
                                    <span>
                                        <button type="button" class="btn btn-primary btn-sm" id="searchBtn" class="btn" onclick="goods.search();" >查询</button>&nbsp;&nbsp;
                                        <button type="button" class="btn btn-primary btn-sm" id="clearBtn" class="btn" onclick="goods.clear();">重置</button>&nbsp;&nbsp;
                                    </span>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </form>
                </div>
            </div>

            <table id="flex" style="display:none"></table>

        </div>


</div>

<script type="text/javascript">

//筛选条件中存在筛选条件时，将焦点移到后面的输入框中
$("#choice").change(function(){

    var value = $(this).val();

    if( value != '' )
        $("#choiceValue").focus();


})


$("#flex").flexigrid({
    url:"/invokingAjax-backend/wms/goodsStore.ajax?operFlg=1&xjx=none",
    dataType: "json",
    colModel : [
        {display: "商品编号", width : 200, align: "left" ,  name : "wg.goodsID" , sortable : true},
        {display: "商品名称", width : 300,align:"left"},
        {display: "规格", width : 220,align:"left"},
        {display: "总库存", width : 100 , align: "left"},
        {display: "可售库存", width : 100 , align: "left"},
        {display: "锁定库存", width : 100 , align: "left"},
        {display: "坏货库存", width : 100 , align: "left"}
    ],
    sortname: "wg.goodsID",
    sortorder: "desc",
    usepager: true,
    rp: 10,
    useRp: true,
    showTableToggleBtn: true,
    onSubmit: function() {
        var dt = $('#search_form').serializeArray();
        $("#flex").flexOptions({params: dt});
        return true;
    }
});

var goods = {
    clear:function(){
        $("#choice").val(1);
        $("#choiceValue").val('');
    },

    search: function() {
        var dt = $('#search_form').serializeArray();

        $("#flex").flexOptions({params: dt}).flexReload();
    },

    //查看仓库
    goodsStoreInfo : function (goodsID) {
        E.open("/quanliadmin/app/wms/goodsStore.pscript?operFlg=2&goodsID=" + goodsID, "", {height: 600,width: 1024, top: 50, left: 150});
    },

    //库存分配
    goodsStorePercent:function( goodsID ){
        E.open("/quanliadmin/app/wms/goodsStore.pscript?operFlg=3&goodsID=" + goodsID, "", {height: 500,width: 700, top: 50, left: 150});
    }

};

</script>

</body>
</html>